<!--
**********************************************************
* @Author: 张小平
* @Date:   2024-05-01
* @Email:  qqshuqian@163.com
* @Last modified: 最后修改日期
* @Description: 文件描述
**********************************************************
-->

<template>
  <basic-container>

    <div class="box">
      <div class="carBox">
        <div class="zyBox">
          <div class="userinfoData">
            <div class="user-top">
              <div class="avatar-box">
                <img  :src="userInfo.avatar||'/img/userPic.png'" alt="" />
              </div>
              <div class="user-top-right">
                <p class="userName">
                <span>
                  {{userInfo.displayName||userInfo.phone||"匿名"}}
                </span>
                  <!--                <el-divider-->
                  <!--                  v-if="userData?.title"-->
                  <!--                  direction="vertical"-->
                  <!--                ></el-divider>-->
                  <!--                <span-->
                  <!--                  v-if="userData?.title"-->
                  <!--                  :title="`${userData?.title || ''} ${jobLevel?.zj || ''}`"-->
                  <!--                >-->
                  <!--                  {{ userData?.title }} {{ jobLevel?.zj }}-->
                  <!--                </span>-->
                </p>
                <p class="today">
                  <span>{{ this.nowDate }}1111</span>
                  <span class="nowWeek">{{ this.nowWeek }}</span>
                </p>
                <p class="welcome"
                >{{ '欢迎您访问'}}<span class="work-day">{{userInfo? this.zzts:''}}</span
                >{{ userInfo ?'天':''}}</p
                >
              </div>
            </div>
            <div class="mytodo">
              <div class="link-box" @click="goToDB"
              ><img :src="mytodoimg" class="iconsize" /><span class="pdt10"
              >我的待办</span
              ></div
              >
              <div class="link-box" @click="goToSQ"
              ><img :src="mysqimg" class="iconsize" /><span class="pdt10"
              >我的申请</span
              ></div
              >
              <div class="link-box" @click="goToCY"
              ><img :src="mycyimg" class="iconsize" /><span class="pdt10"
              >我的参与</span
              ></div
              >
              <div class="link-box" @click="goToCC"
              ><img :src="myccimg" class="iconsize" /><span class="pdt10"
              >我的抄送</span
              ></div
              >
            </div>
          </div>
        </div>
      </div>
    </div>
  </basic-container>
</template>
<script>
  import { mapGetters } from "vuex";
  export default {
    components: {},
    data() {
      return {
        nowWeek: '',
        nowDate: '', // 今天得日期
        zzts: 0, // 在职天数
        mytodoimg: '/img/mh1.png',
        mysqimg: '/img/mh2.png',
        mycyimg: '/img/mh3.png',
        myccimg: '/img/mh4.png'
      };
    },
    computed: {

      ...mapGetters([
        "setting",
        "userInfo",
        "roles"
      ])
    },
    created() {
      // this.rateVal = Number((Math.random() * (5 - 3) + 3).toFixed(2));
      // this.getPictureFiles();
      // this.getPersonalCenter();
    },
    methods: {

      goToDB: function () {
        this.$router.push({path: '/oa/todo'});
      },
      goToSQ: function () {
        this.$router.push({path: '/oa/application'});
      },
      goToCY: function () {
        this.$router.push({path: '/oa/join'});
      },
      goToCC: function () {
        this.$router.push({path: '/oa/cc'});
      },
    }
  };
</script>
<style scoped lang="scss">
  .box {
    position: relative;
  }
  .carBox {
    // height: 182px;
    background: #ffffff;
    // box-shadow: 0px 0px 6px 0px rgba(6, 0, 1, 0.1);
    // border-radius: 20px;
    min-height: 150px;
    /*padding: 17px 23px 17px;*/
    /*margin: 10px 0;*/

    .header {
      display: flex;
      justify-content: space-between;
      font-weight: bold;
      color: var(--color-primary);
      border-bottom: 1px solid #e5e5e5;
      padding-bottom: 12px;
      .title {
        font-size: 18px;
        font-family: Source Han Sans CN;
      }
      .more {
        cursor: pointer;
        color: var(--color-primary);
      }
    }
    .zyBox {
      //   margin-top: 20px;
      display: flex;
      flex-direction: column;
      justify-content: center;
      //   height: 200px;
      .item-box {
        display: flex;
        height: 60px;
        background: #fff8ef;
        border-radius: 8px;
        align-items: center;
        justify-content: space-between;
        padding: 0 15px;
        font-weight: bold;
        color: #333333;
        font-size: 16px;
        margin: 10px 0;
        .item-img {
          display: flex;
          align-items: center;
        }
        img {
          width: 40px;
          height: 40px;
          margin-right: 12px;
        }
      }
      .item-box2 {
        background: #f2feff;
      }
    }
  }
  .card__header {
    position: absolute;
    width: 100%;
    height: 100%;

    /*background-color: none;*/
    z-index: 10;
    display: flex;
    justify-content: center;
    align-items: center;

    & > div {
      z-index: 11;
      cursor: pointer;
      display: none;
      color: #fff;
      font-size: 18px;

      margin: 0 10px;
      &:hover {
        color: var(--color-primary);
      }
    }

    &:hover {
      background: rgba(0, 0, 0, 0.5);

      & > div {
        display: block;
      }
    }
  }

  .userinfoData {
    // height: 340px;
    // padding: 15px;
    overflow: hidden;

    .user-top {
      display: flex;
    }
    .user-top-right {
      flex: 1;
      margin-top: 15px;
      padding-left: 20px;
    }
    .avatar-box {
      width: 100px;
      display: flex;
      justify-content: center;
      margin-top: 20px;
      img {
        width: 100px;
        border-radius: 50%;
      }
    }
    & p {
      font-size: 18px;
      font-weight: 700;
      color: #333;
      display: flex;
      align-items: center;
      //   justify-content: center;
      & .line {
        width: 0.05rem;
        height: 16px;
        background: #666;
        margin: 0 3px;
      }
    }
    & .userName {
      white-space: nowrap;
      margin: 10px 0;

      span:last-child {
        overflow: hidden;
        display: -webkit-box;
        -webkit-line-clamp: 1;
        -webkit-box-orient: vertical;
        text-overflow: ellipsis;
        white-space: normal;
      }
    }
    & .welcome {
      margin: 0;
      font-size: 16px;
      color: #999;
      font-weight: normal;
      margin-top: 5px;
      display: inline-block;
      overflow: hidden;
      display: -webkit-box;
      -webkit-line-clamp: 2;
      -webkit-box-orient: vertical;
      text-overflow: ellipsis;
      white-space: normal;
      & .work-day {
        color: #1871db;
        font-weight: 700;
      }
    }
    & .today {
      font-size: 16px;
      margin-top: 15px;
      font-weight: normal;
      color: #999;
      display: flex;
      align-items: center;
      line-height: 1;
      .nowWeek {
        margin-left: 5px;
      }
    }
    & .mytodo {
      display: flex;
      align-items: center;
      font-size: 14px;
      margin-top: 35px;
      & div {
        // padding: 0 20px;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: space-between;
      }
      & .line {
        width: 0.05rem;
        height: 70px;
        background: #666;
        // margin: 0 3px;
        padding: 0;
        margin-right: 10px;
      }
      & .pdt10 {
        padding-top: 10px;
        color: #222;
      }
      .iconsize {
        width: 50px;
      }
      .link-box {
        cursor: pointer;
        width: 25%;
      }
    }
  }
</style>
